#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2505;
const int M = 1e4 + 5;

int n, m, k;
ll a[N];
int head[N];
int ver[M << 1], Next[M << 1], tot;
void add(int u, int v) {
  ++tot;
  ver[tot] = v;
  Next[tot] = head[u];
  head[u] = tot;
}
int g[N][N];
int dis[N];
void bfs(int s) {
  memset(dis, -1, sizeof(dis));
  queue<int> q;
  q.push(s);
  dis[s] = 0;
  g[s][s] = 1;
  while (q.size()) {
    int u = q.front();
    q.pop();
    if (dis[u] > k) break;
    for (int i = head[u]; i; i = Next[i]) {
      int v = ver[i];
      if (dis[v] == -1) {
        dis[v] = dis[u] + 1;
        q.push(v);
        g[s][v] = 1;
      }
    }
  }
}
vector<int> neigb[N];
bool cmp(int i, int j) { return a[i] > a[j]; }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  rep(i, 2, n) cin >> a[i];
  rep(i, 1, m) {
    int u, v;
    cin >> u >> v;
    add(u, v), add(v, u);
  }
  rep(i, 1, n) bfs(i);
  rep(i, 2, n) {
    rep(j, 2, n) {
      if (j == i) continue;
      if (g[1][j] && g[j][i]) neigb[i].push_back(j);
    }
    sort(neigb[i].begin(), neigb[i].end(), cmp);
  }
  ll ans = 0;
  rep(i, 2, n) rep(j, i + 1, n) {
    if (!g[i][j]) continue;
    for (int u = 0; u < neigb[i].size() && u < 3; u++) {
      int x = neigb[i][u];
      if (x == j) continue;
      for (int v = 0; v < neigb[j].size() && v < 3; v++) {
        int y = neigb[j][v];
        if (y == x || y == i) continue;
        ans = max(ans, a[i] + a[j] + a[x] + a[y]);
      }
    }
  }
  cout << ans;
  return 0;
}